import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 手环午睡数据信息 */
export interface DeviceKidbandSleepData {
          id: number; // 编号
          imei?: string; // 序列号
          nfcCode?: string; // NFC
          macCode?: string; // MAC地址
          schoolCode?: string; // 所属园区
          classId?: number; // 班级ID
          studentId?: number; // 学生ID
          studentName: string; // 学生姓名
          startTime: string | Dayjs; // 开始时间
          endTime: string | Dayjs; // 结束时间
          sleepMinutes?: number; // 午睡分钟数
          sleepType?: number; // 睡眠状态
          sort?: number; // 排序
          status?: number; // 状态
  }

// 手环午睡数据 API
export const DeviceKidbandSleepDataApi = {
  // 查询手环午睡数据分页
  getDeviceKidbandSleepDataPage: async (params: any) => {
    return await request.get({ url: `/school/device-kidband-sleep-data/page`, params })
  },

  // 查询手环午睡数据详情
  getDeviceKidbandSleepData: async (id: number) => {
    return await request.get({ url: `/school/device-kidband-sleep-data/get?id=` + id })
  },

  // 新增手环午睡数据
  createDeviceKidbandSleepData: async (data: DeviceKidbandSleepData) => {
    return await request.post({ url: `/school/device-kidband-sleep-data/create`, data })
  },

  // 修改手环午睡数据
  updateDeviceKidbandSleepData: async (data: DeviceKidbandSleepData) => {
    return await request.put({ url: `/school/device-kidband-sleep-data/update`, data })
  },

  // 删除手环午睡数据
  deleteDeviceKidbandSleepData: async (id: number) => {
    return await request.delete({ url: `/school/device-kidband-sleep-data/delete?id=` + id })
  },

  /** 批量删除手环午睡数据 */
  deleteDeviceKidbandSleepDataList: async (ids: number[]) => {
    return await request.delete({ url: `/school/device-kidband-sleep-data/delete-list?ids=${ids.join(',')}` })
  },

  // 导出手环午睡数据 Excel
  exportDeviceKidbandSleepData: async (params) => {
    return await request.download({ url: `/school/device-kidband-sleep-data/export-excel`, params })
  },
}